<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    	               "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" import="com.uft.model.entity.*,java.util.List"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page isELIgnored="false"%>
<sec:authentication var="principal" property="principal" />
<html>
  <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    	<title>UFT Application</title>
    	<%@ include file="jsp/header.jsp" %>
  		<script>
		  $(function() {
			  $("#loadingScreen").dialog({
			        autoOpen: false,    // set this to false so we can manually open it
			        dialogClass: "loadingScreenWindow",
			        closeOnEscape: false,
			        draggable: false,
			        width: 200,
			        minHeight: 50,
			        modal: true,
			        buttons: {},
			        resizable: false,
			        open: function() {
			            // scrollbar fix for IE
			            $('body').css('overflow','hidden');
			        },
			        close: function() {
			            // reset overflow
			            $('body').css('overflow','auto');
			        }
			  }); // end of dialog
			  $( "#logout").button({
	        		icons: {
	        	           primary: "logout-icon"
	        	         }
			  		
	        	})
	        $(".account").click(function(){
	        	var X=$(this).attr('id');
	        	if(X==1)
	        	{
	        		$(".submenu").hide();
	        		$(this).attr('id', '0'); 
	        	}
	        	else
	        	{
	        		$(".submenu").show();
	        		$(this).attr('id', '1');
	        	}
	        });
		   $(".submenu").mouseup(function()
				  {
				  return false
			});
		   $(".account").mouseup(function()
				   {
				   return false
			});
		   $(document).mouseup(function()
				   {
				   $(".submenu").hide();
				   $(".account").attr('id', '');
			});
	        		
		    var menuTabs= $( "#menuTabs" ).tabs({
		    	heightStyle: "fill",
		    /*	beforeLoad: function (event, ui) {
		    	    //show msg
		    		$.loader({
		    	        className:"blue-with-image-2",
		    	        content:''
		    	    });
		    	  },
		    	  load: function (event, ui) {
		    	    //hide msg
		    		$.loader('close');
		    	  } */
		    	activate:function(event,ui){  	    		
                 //   alert(ui.index); 
		    		selected = ui.newTab.context.id;
		    		var divId=$('#menuTabs ul li a[id='+selected+'] ').attr( "href" );
		    		if(divId == "#serverTab"){
	    				$("#serverTab").load("getServerListView.htm");	
	    				
	    			}
		    		if(divId == "#dashboard"){
	    				$("#dashboard").load("getDashboardView.htm");	
	    			}
		    		
		    		<sec:authorize ifAllGranted="ROLE_ADMIN">
		    		if(divId == "#administration"){
	    				$("#administration").load("getAdminView.htm");	
	    			}
		    		</sec:authorize>
		    		<sec:authorize ifAllGranted="ROLE_ADMIN">
		    		if(divId == "#wasConfiguration"){
	    				$("#wasConfiguration").load("getWasConfiguration.htm");	
	    			}
		    		</sec:authorize>
		    		<sec:authorize ifAllGranted="ROLE_ADMIN">
		    		if(divId == "#datapower"){
	    				$("#datapower").load("getDatapowerView.htm");	
	    			}
		    		</sec:authorize>
		    		
		    		
	                
                } 
		    });
		    $( "#notificationDialog" ).dialog({
			      autoOpen: false,
			      width: 300,
			      show: {
			        effect: "blind",
			        duration: 1000
			      }
			      
			    });
		
		    $("#taskNotificationBtn").button({
		    	icons: {
		    		primary: "ui-icon-lightbulb"
		    		
		    	}
		    }).click( function() {
		    	
		    	$( "#notificationDialog" ).dialog("open");
		    	
		    	 
		    	
		    });
		   
		  });
		  $( document ).ajaxStart(function() {
			  $( "#loading" ).show();
		  });
		  $( document ).ajaxStop(function() {
			  $( "#loading" ).hide();
		  }); 
		 
		  function waitingDialog(waiting) {
			  $("#loadingScreen").html(waiting.message && '' != waiting.message ? waiting.message : 'Please wait...');
			  $("#loadingScreen").dialog('open');
			  $("#loadingScreen").dialog('option', 'title', waiting.title && '' != waiting.title ? waiting.title : 'Loading');
			 
		  };
		  function closeWaitingDialog() {
			  $("#loadingScreen").dialog('close');
		  };
  		</script>
  </head>
  <body>
  <table width="100%" border=0><tr>
  	<!-- <td><img src="images/logo-19.png" width="150px" height="60px" /></td>  -->
  	<td width="100%" style="padding-right:5px" align="right">
  		<button id="taskNotificationBtn" class="notificationButton">0</button>
  		
  	</td>
  	<td style="padding-left:15px" align="right" valign="middle">
  		<div class=" dropdown ">
			<a class="account" ><u><b><c:out value="${fn:toUpperCase(principal.username)}"></c:out></b></u></a>
			<div class="submenu">
				<ul class="root">
				<li ><a href="<c:url value="j_spring_security_logout" />" >Logout</a></li>
				
				</ul>
			</div>
		</div>	
  	</td>
  	<td>
  		<div id="loading" style="display:none">
		  <p><img src="images/16/ui-anim_basic_16x16.gif" /></p>
		</div>
  	</td>
  	</tr>
  </table>
  	<div id="mainAlertBox">
  		
  	</div>
    <div id="menuTabs">
	  <ul>
	    <li><a href="#menuTabDemo">Demo</a></li>
	    <li><a href="#dashboard" >Dashboard</a></li>
	     <li><a href="#serverTab">Servers</a></li>
	     <sec:authorize ifAllGranted="ROLE_ADMIN">
	   			 <li><a href="#administration"><span>Administration</span></a></li>
	    		 <li><a href="#wasConfiguration"><span>WAS Configuration</span></a></li>
	    		 <li><a href="#datapower"><span>Datapower</span></a></li>
	     </sec:authorize> 
	    
	  </ul>
	  <div id="menuTabDemo">
	   	<img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading Demo.....Please wait
	  </div>
	  <div id="dashboard">
	   	<img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading Dashboard.....Please wait
	  </div>
	  <div id="serverTab">
	  	<img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading Servers.....Please wait
	  </div>
	  <sec:authorize ifAllGranted="ROLE_ADMIN">
		  <div id="administration">
		 	 <img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading Admin.....Please wait
		  </div>
		  <div id="wasConfiguration">
		 	 <img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading WAS Configuration.....Please wait
		  </div>
		   <div id="datapower">
		 	 <img src="<c:url value="/images/16/ui-anim_basic_16x16.gif"/>" alt="loading">Loading Datapower.....Please wait
		  </div>
	  </sec:authorize> 
	   
	  
	</div>
	<div id="notificationDialog">
	  
	</div>
	<div id="alertDialog">
	</div>
	<div id="loadingScreen"></div>
  </body>
</html> 
